# coding: utf-8
# Author: Miracle Yoo
import torch


class Config(object):
    def __init__(self):
        # 公共参数设置
        self.USE_CUDA           = torch.cuda.is_available()
        self.MODEL              = "TextCNN"         #"TextCNN" "TextCNNDeep" "TextCNNIncDeep"
        self.MODEL_NAME         = "TextCNN_WORD"    #"TextCNN_WORD" "TextCNNDeep_WORD" "TextCNNIncDeep_CHAR_v9"
        self.RUNNING_ON_SERVER  = True
        self.SUMMARY_PATH       = "summary/TextCNN_WORD"    #"summary/TextCNNIncDeep_CH_AR_v9"
        self.NET_SAVE_PATH      = "trained_net" #"./source/trained_net/"
        self.TRAIN_DATASET_PATH = "data"        #"/disk/Beibei_Dataset/train_data_v5.csv"
        self.TEST_DATASET_PATH  = "data"        #"/disk/Beibei_Dataset/yibot_test_1617.csv"
        self.NUM_EPOCHS         = 400           #20,30,60,100,200,400,50000
        self.BATCH_SIZE         = 64            #32,64,128,200,300,400
        self.NUM_TRAIN          = 0             #动态赋值 #self.NUM_EPOCHS * self.BATCH_SIZE
        self.NUM_TEST           = 0             #动态赋值
        self.STEP_PER_EPOCH     = 0             #每轮迭代需要执行多少步，动态赋值
        self.TEST_STEP          = 200           #每训练多少步验证一次 100,124,200
        self.TOP_NUM            = 3
        self.NUM_WORKERS        = 8
        self.IS_TRAINING        = True
        self.ENSEMBLE_TEST      = False
        self.LEARNING_RATE      = 1e-4          #0.001, 0.0005, 0.01, 0.0001
        self.RE_TRAIN           = False
        #self.USE_PAIR_MAPPING   = False         #TODO：WILL BE REMOVED
        self.USE_TRAD2SIMP      = False
        self.TEST_POSITION      = 'Gangge Server'   #TODO：WILL BE REMOVED

        # 模型共享参数设置
        self.OPTIMIZER          = 'Adam'
        self.USE_CHAR           = False     #TODO：WILL BE REMOVED #True
        self.SENT_LEN           = 160       #30,60,90,100,120,140,150,160,180,200
        self.EMBEDDING_DIM      = 80        #词嵌入的维度 50,80,100,128,150,200,300       
        self.USE_WORD2VEC       = False
        self.BANLANCE           = True
        self.NUM_CLASSES        = 0         #动态赋值1890,145,68
        self.VOCAB_SIZE         = 0         #采用前多少个词，论文建议小于30k个词 #20029
        self.CHAR_SIZE          = 0         #采用前多少个字符 #3403

        # LSTM模型设置, TODO：WILL BE REMOVED
        #self.LSTM_HID_SIZE      = 512
        #self.LSTM_LAYER_NUM     = 2
        #self.K_MAX_POOLING      = 1

        # TextCNN, TextCNNDeep模型设置
        self.TITLE_DIM          = 100        #50,100,150,200,256,300,400,512,600
        self.KERNEL_SIZE        = [2, 3, 4]       #[2, 3, 4, 5]
        #self.LINER_HID_SIZE     = 1409     #TODO：WILL BE REMOVED
        #self.TITLE_EMBEDDING    = 256      #TODO：WILL BE REMOVED #仅用在TextCNNCos中

        # TextCNNDeep, TextCNNIncDeep模型设置
        self.NUM_ID_FEATURE_MAP = 250       # CNN模型的Channels, 经测试150,250,350中250最优

        # DilaTextCNN模型设置, TODO：WILL BE REMOVED
        #self.DILA_TITLE_DIM = 20

        # TextCNNInc模型设置
        self.SIN_KER_SIZE = [1, 3]  # single convolution kernel
        self.DOU_KER_SIZE = [(1, 3), (3, 5)]  # double convolution kernel

        # 模型融合
        self.MODEL_NAME_LIST    = ["TextCNNINC_CHAR_v5.pth", "TextLSTM_CHAR_v5.pth"]
        self.MODEL_THETA_LIST   = [1, 0.8]

